package buildingtypes;

import java.util.ArrayList;

import websimulator.TechniqueEquipment;

public class Supermarket extends PublicBuildings {


	
	public Supermarket(int people, double area, ArrayList<Double> _tempOut,
			ArrayList<Double> _tempIn, ArrayList<Double> _lys, int heatingType,
			int buildingType, int directive, double wallHeight, int start,
			int end) {
		super(people, area, _tempOut, _tempIn, _lys, heatingType, buildingType,
				directive, wallHeight, start, end);
		// TODO Auto-generated constructor stub
	}

	/*
	 * Walk-in freezers
	 * Walk-in coolers 
	 * Self-service freezers (with and whitout doors)
	 * Self-service coolers  (whit and whitout doors)
	 * 
	 * 
	 * */
	
	/**
	 * 
	 * @param start
	 */
	public void setStart(int start)
	{
		this.start = start;
	}
	/**
	 * 
	 * @param end
	 */
	public void setEnd(int end)
	{
		this.end = end;
	}
	/**
	 * 
	 * @param area
	 * @param numberOfGlassDoors
	 * @return walkInFreezer
	 */
	public TechniqueEquipment calcWalkInFreezer(double area, double numberOfGlassDoors)
	{
		double consumption;
		TechniqueEquipment walkInFreezer;
		double powerDensisty = 1;
		
		if(area < 30)
		{powerDensisty = 16;}
		if(area >= 30 && area < 75 )
		{powerDensisty = 12;}
		if(area >= 75 && area < 140 )
		{powerDensisty = 9.5;}
		if(area >= 140 && area < 200 )
		{powerDensisty = 8;}
		if(area >= 200 && area < 250 )
		{powerDensisty = 7;}
		if(area >= 250 && area < 300 )
		{powerDensisty = 6.5;}
		if(area > 300 )
		{powerDensisty = 6;}
		
		consumption = (area*powerDensisty) + (numberOfGlassDoors * 325);
		walkInFreezer = new TechniqueEquipment("Walk-In freezer", consumption, 18);
		
		return walkInFreezer;
	}
	
	/**
	 * 
	 * @param cubic
	 * @return walkInCooler
	 */
	public TechniqueEquipment calcWalkInCooler(double cubic)
	{
		
		double consumption = 4.0 * cubic;
		TechniqueEquipment walkInCooler = new TechniqueEquipment("Walk-in cooler" , 16, consumption);
		
		return walkInCooler;
	}
	
	/**
	 * 
	 * @param meter
	 * @param doors
	 * @return freezer
	 */
	public TechniqueEquipment calcFreezers(double meter, boolean doors)
	{
		double consumption;
		double energyFactor = 1;
		if (doors)
		{
			energyFactor = 65.532;
		}
		if(!doors)
		{
			energyFactor = 86.532;
		}
		consumption = energyFactor*meter;
		TechniqueEquipment freezer = new TechniqueEquipment("Freezer" , 18, consumption);
		
		return freezer;
		
	}
	
	/**
	 * 
	 * @param meter
	 * @param doors
	 * @return cooler
	 */
	public TechniqueEquipment calcCoolers(double meter, boolean doors)
	{
		double consumption;
		double energyFactor = 1;
		if (doors)
		{
			energyFactor = 37.49;
		}
		if(!doors)
		{
			energyFactor = 48.76;
		}
		consumption = energyFactor*meter;
		
		TechniqueEquipment cooler = new TechniqueEquipment("Cooler" , 16, consumption);
		
		return cooler;
	}

}
